package Demo1299.Demo5;

import java.lang.reflect.Method;

/**
 * @Author:LiRegin
 * @Date: 2019/12/8 16:38:09
 */
public class Test {
    public static void main(String[] args) throws Exception {
        Class<?> aClass = Class.forName("Demo1299.Demo5.Cat");
        Object o = aClass.getConstructor().newInstance();
        Method setName = aClass.getMethod("setName", String.class);
        Object a1 = setName.invoke(o, "大黄");
        Method getName = aClass.getMethod("getName");
        System.out.println(getName.invoke(o));
    }
}
